class_name Combat
extends Reference

var query: QueryManager
var world

var ext_attr
var ext_com


# this file is called before the world init
func _init(_world):
	world = _world
	query = _world.query_manager
	register_multis()

	ext_attr = ExtAttr.new(world)
	ext_com = ExtCommon.new(world)


# register multi by code not by editor
func register_multis():
	var damage = Multi.new(Damage.DamageC.component_name)
	query.register_multi(damage)
	var be_damage = Multi.new(Damage.BeDamageC.component_name)
	query.register_multi(be_damage)

	var cast_state = Multi.new(Cast.CastStateC.component_name)
	query.register_multi(cast_state)
	var be_cast_state = Multi.new(Cast.BeCastStateC.component_name)
	query.register_multi(be_cast_state)


func set_lib(skill_map, buff_map):
	var skill_lib = SkillLib.new()
	var skill_single = Single.new(SkillLib.component_name)
	skill_single.data = skill_lib
	query.register_single(skill_single)

	var buff_lib = BuffLib.new()
	var buff_single = Single.new(BuffLib.component_name)
	buff_single.data = buff_lib
	query.register_single(buff_single)

	skill_lib.map = skill_map
	buff_lib.map = buff_map
